home *** CD-ROM | disk | FTP | other *** search
/ CD ROM Paradise Collection 4 / CD ROM Paradise Collection 4 1995 Nov.iso / dskutil / presz110.zip / PRESIZER.DOC < prev    next >
Text File  |  1994-12-11  |  38KB  |  693 lines

  1.  
  2.  
  3.  
  4.  
  5.  
  6.  
  7.  
  8.  
  9.                         Partition Resizer v. 1.1.0
  10.                         ==========================
  11.                              (c) Zeleps 1994
  12.                              ===============
  13.  
  14.  
  15.                 Program's Manual and Technical Information
  16.  
  17.  
  18.  
  19.  
  20.  
  21.  
  22.  
  23.  
  24.  
  25.  
  26. This file contains important information about the working and usage of
  27. Partition Resizer. Please read it carefully before using Partition Resizer.
  28. You MUST also read README.1ST before running Partition Resizer.
  29.  
  30. NOTE: This program is freeware. You may freely copy it and distribute it,
  31. as long as it remains unchanged and it is distributed with its original 
  32. doc files. The author is not responsible for any damage caused by the use of 
  33. this program. Using this program is completely at your own responsibility.
  34.  
  35. 1- What is Partition Resizer
  36.  
  37.    1.1 Why you need Partition Resizer
  38.    1.2 How does it work?
  39.    1.3 Is it safe?
  40.    1.4 Changes made to previous versions
  41.  
  42. 2- Working with Partition Resizer
  43.  
  44.    2.1 Safety precautions
  45.    2.2 Running the program: What does what
  46.  
  47. 3- Technical matters
  48.  
  49.    3.1 The partition system
  50.    3.2 The DOS partition structure
  51.    3.3 Is it all that easy?
  52.  
  53. 4- Partitioning Techniques
  54.  
  55.    4.1 Deciding what you want
  56.    4.2 Collecting many small partitions into a larger one
  57.    4.3 Splitting a partition in two
  58.    4.4 Playing with partitions' sizes and positions
  59.  
  60. 5- Credits and addresses
  61.  
  62.                                 -------||-------
  63.  
  64. 1- What is Partition Resizer
  65.  
  66.    1.1 Why you need Partition Resizer
  67.  
  68. For the last two years, more and more people search for more power in the
  69. new Operating Systems, like OS/2 or Windows NT, or even Linux and other
  70. Unices. But trying to escape from the black and white world of DOS isn't
  71. always that easy, since most of the existing (and interesting) software is
  72. still running under DOS. So, most of these users try to keep a DOS partition
  73. along with the new OS's partition. But this is not always easy, since
  74. repartitioning means loss of data, leading to the need of backup streamers,
  75. or worse (floppy backups). So, many users prefer to loose some of their data,
  76. while backing up the most valuable of it, in order to repartition their hard
  77. drive. I was in the same situation myself, so I thought: "Why not make a 
  78. resizing program? This would save me time and money". So I made this little
  79. program, which does exactly that: It can change a FAT partition's size, and
  80. it can move this partition into the empty disk space, so that you can make
  81. space to create new partitions, or when you get many small partitions, you can
  82. grow them into one larger. Well, all you have to do is to read carefully all
  83. the instructions, and then use the program. In section 3, I have included
  84. many technical information that will help you not only understand how this
  85. program works, but to get some basic knowledge on the partitioning and
  86. FAT file system.
  87.  
  88. But remember: This program does not intend to replace FDISK. It's rather
  89. complementary to it. You will need FDISK as soon as you make some empty
  90. disk space, in order to create the new partition. Partition Resizer does not
  91. remove partitions, and it does not create new ones.
  92.  
  93.  
  94.    1.2 How does it work?         
  95.    
  96. Well, this is the tricky part. The details are described in section 3, but
  97. I'll try to make a start from here. I assume that everybody understands the
  98. importance of partitioning. I also assume that most of you understand how 
  99. partitioning is achieved. For those who don't, here it is: 
  100.  
  101. Partitioning is just a marking of territories on the physical disk's surface.
  102. At the first sector of the disk (sector 1, head 0, cylinder 0) resides an 
  103. executable code block, which looks for the bootable partition, and runs
  104. it's boot sector code. That sector contains the information needed to 
  105. divide the disk space into partitions. Later on, the boot sector (which is
  106. created by the OS's format utility) loads the OS Kernel (in DOS's case it
  107. loads the IO.SYS and the MSDOS.SYS), which continue the job by loading
  108. the information of all the partition structure into memory.
  109.  
  110. Partition Resizer does two things: When moving, apart from moving the data, 
  111. it changes the information contained in the partition structure. When
  112. resizing, it changes the file system's data, which is contained in the
  113. boot sector and the FAT area. Both partition and FAT FS structures are
  114. explained at section 3. 
  115.  
  116.  
  117.    1.3 Is it safe?
  118.  
  119. The program has worked correctly in all cases, and no bugs have been 
  120. detected after hundreds of tests. I have tested all the partition combinations
  121. I could think of, and it worked correctly. After the tests, every file in
  122. the partition was compared with the originals, and the partition itself
  123. was checked byte by byte with the Disk Editor. Everything seems to work fine,
  124. and so is for several other systems. I also tried it on my primary hard
  125. disk, which is a Western Digital Caviar 2340, without backing up my data
  126. (I ensure you that I have valuable data stored in there). Everything went
  127. great, and the system is working perfectly, without a byte missing. 
  128.  
  129. But these tests cannot cover all cases, since there are millions of 
  130. combinations that can be made. So, even if the program worked great till now,
  131. there might still be some bugs. In case you find a bug, please inform me ASAP.
  132. In order to avoid trouble, you should backup the most valuable data in your
  133. disk, those that cannot be replaced. If something happens, you'll only have
  134. to reinstall what's lost.
  135.  
  136. But reliability isn't everything. Stability is also a great factor. And this
  137. program is so stable that it can restore its work even after a sudden power
  138. shutdown! Normally, if the program was interrupted during the resizing
  139. or moving process, it would be impossible to access the partition's data again.
  140. This program stores every single step, so it always knows what the last action
  141. was. For speed and safety reasons I use the cmos's bytes 1,3 and 5 (the
  142. alarm bytes) to store the step counter number. Because the contents of the 
  143. cmos are preserved even when the power is off, the program can always find
  144. the last step and continue it's work like nothing happened. If you don't 
  145. believe it, test it.
  146.  
  147. There is only one thing that I couldn't prevent: Bad sectors. In case your
  148. disk has bad sectors, the program will not run, in order to protect your
  149. data. It will make a surface scan before it starts, but if you are certain
  150. that your disk is free of defects, you may skip it. It would be better if you
  151. had your disk surface scanned with a commercial program (like Norton Disk 
  152. Doctor or PC Tools DiskFix) before you run Partition Resizer. 
  153.  
  154.  
  155.    1.4 Changes made to previous versions
  156.  
  157. - Many drives support (instead of two) added
  158. - Minor changes in the interface
  159. - Error trapping system changed
  160. - EIDE and SCSI support added (should be working with every hard disk now)
  161. - Some bugs fixed
  162.  
  163.  
  164. 2- Working with Partition Resizer
  165.  
  166.    2.1 Safety Precautions
  167.  
  168. As with every program that messes with your data, you should be extra
  169. careful. It is not difficult to make a mistake that will cost you valuable 
  170. data. So, you must follow carefully the instructions contained in the
  171. file README.1ST, in order to ensure data safety. It would be a good idea
  172. to print TROUBLE.DOC file in order to have it available when something
  173. wrong happens.
  174.  
  175.  
  176.    2.2 Running the program: What does what
  177.  
  178. The program will first look for the disk characteristics, it will scan the
  179. partition information, and it will identify and check all the DOS partitions
  180. of the disk. After some basic checks, it will continue with the main menu
  181. of the program. Here you have 5 choices. The first is resizing a DOS partition
  182. or an extended partition. This option will resize a partition in order to 
  183. make free space for a new partition to be created. It will also grow a 
  184. partition if there is unallocated space available and the cluster size is big
  185. enough. You can also resize extended partitions. When you resize the 
  186. partition, you may use the second option, move partition, to move the
  187. partition in the empty space. This way you will be able to change the order
  188. of the partitions in the disk. The third option is used to change a 
  189. partition's cluster size. This will help you to make a small new partition 
  190. able to grow up to any size you want. This option should be used ONLY on
  191. empty and formatted partitions, since it deletes all the data inside the
  192. partition. The fourth option will show you detailed information for every
  193. partition on the disk. This may sometimes help you find out which partition
  194. you want to move or resize. The last option will exit the program, and if
  195. you made any changes to the partition structure it will immediately reboot
  196. the machine, so that the new information will be loaded from the disk.
  197.  
  198. Every choice but 5, will lead you to a menu where you will be asked to choose
  199. the partition which should be modified. Just enter the partition's number
  200. and press enter. On the left of every partition description, there can be 
  201. three markings. The marking * shows that the specified partition can be 
  202. resized. Only partitions with * can be resized. The marking # shows which 
  203. partitions can be moved. Marking ! shows that a partition is incompatible with 
  204. the program, therefore it cannot be moved or resized. All partitions can be 
  205. moved, but this is not always safe. I have tried moving FAT and HPFS 
  206. partitions successfully, but I cannot be sure for every partition type. If you 
  207. decide to move any other partition type but FAT, you will be proceeding at 
  208. your own risk. 
  209.  
  210. After choosing the partition you want, you will be asked to change the
  211. new partition's size or move it. This can be done on the Cylinders map,
  212. with the +,-,*,/ keys. You can always press ESC to quit to main menu. 
  213. If you decide that the new setting satisfy you, you may then press enter.
  214. You will be asked to confirm your action, so you should press 'y' here.
  215. Any other key will get you back to main menu. 
  216.  
  217. The screen will now clear, and you will be asked whether you want to perform
  218. a surface test or not. This is not necessary if you know that your disk
  219. is free of defects or if you performed a surface test recently, since
  220. it will take some time (from several seconds to 15 minutes, depending on the
  221. size of the partition). If you are uncertain, perform the surface test, since
  222. bad sectors can be dangerous to your data. If the program finds any bad 
  223. sectors, it will quit immediately. If the surface test concludes normally,
  224. the program will start performing the requested changes. This may take from
  225. a few seconds to a few hours, so be prepared. If the program is terminated
  226. abnormally, p.e. in case of a power shutdown, don't worry, you can always
  227. reboot and run the program again. It will continue exactly from the point it
  228. stopped, so there is no worry. After it finishes, you may proceed with more
  229. changes, or exit the program, which will boot your machine.
  230.  
  231. Sounds easy? Well, it should be. But if you are confused, you better check out
  232. what's on the next section, just to get an idea about the whole partitioning
  233. system. If you still have questions, you can get help from friends, or contact
  234. me via my Internet, Fidonet, or Signet addresses (see the end of this 
  235. document). If you don't have access to any of these networks, you can send
  236. me a letter (postcard preferred) and I will try to help you as much as I can.
  237. Don't forget to tell me details about your system, your partitions, and if
  238. you can, send me hard copies of the info screens from Partition Resizer.
  239.  
  240.  
  241. 3- Technical Matters
  242.  
  243.    3.1 The partition system
  244.  
  245. The partition system is one of the most important things on the disk 
  246. subsystem. It is a standard beyond File Systems and Operating Systems.
  247. The partition structure looks very much like the DOS directory structure. 
  248. The root directory here is the root sector, the first sector of the disk.
  249. When the machine boots, bios loads this sector at address 7C00:0000, 
  250. and jumps there. As you understand, there is code written at the beginning
  251. of that sector. This code searches the primary partition list to see which
  252. one is bootable, then loads its first sector (the boot sector) at the same
  253. address (7C00:0000) and it jumps there. After that, it is the operating 
  254. system that takes control. 
  255. Let's see some more details. Here is a detailed map of the root partition
  256. sector (sector 1, head 0, cylinder 0) (you may often see it as MBR, master
  257. boot record):
  258.  
  259. Offset             Description                
  260.  
  261. 0x000-0x0DA        Boot code
  262. 0x1BE-0x1CD        First Primary partition descriptor
  263. 0x1CE-0x1DD        Second Primary partition descriptor
  264. 0x1DE-0x1ED        Third Primary partition descriptor
  265. 0x1EE-0x1FD        Fourth Primary partition descriptor
  266. 0x1FE-0x1FF        System Marking word (0xAA55)
  267.  
  268. Boot code is the executable code that was described above. The partition
  269. descriptors have the following form:
  270.  
  271. Offset             Description
  272.  
  273. 0x0                Boot marking
  274. 0x1                Side                    \
  275. 0x2                Sector & Cylinder 8-9    >  Starting location
  276. 0x3                Cylinder 0-7            /
  277. 0x4                System Description
  278. 0x5                Side                    \
  279. 0x6                Sector & Cylinder 8-9    >  Ending location
  280. 0x7                Cylinder 0-7            /
  281. 0x8-0xB            Relative sector
  282. 0xC-0xF            Number of sectors in partition
  283.  
  284. Boot marking is a byte value, which can be either 0 or the drive number
  285. (0x80). If it is 0x80 then the partition is the active partition of the
  286. disk (boot partition), and that's where the system boots from. The next
  287. 3 bytes contain the side, cylinder and sector where the partition begins.
  288. Sector and cylinder are stored in two bytes. Bits 0-7 of the cylinder
  289. value are stored in the second byte, while bits 8-9 are stored at the
  290. high bits of the first byte. The sector value is stored at bits 0-5 of the
  291. first byte. So, the word is bitmapped like this:
  292.  
  293. FEDCBA98 76543210
  294. CCCCCCCC CCSSSSSS
  295. 76543210 98543210
  296.  
  297. where C are Cylinder bits (the number below shows which cylinder bit is
  298. which) and S are Sector bits. Right after is the system byte, which is
  299. the identification byte for the partition. A value of 0 Means that the 
  300. partition is not being used, while other values depend on the file system.
  301. DOS uses values 1,4 and 6 for FAT12, FAT16 and BigDOS partitions respectively.
  302. A value of 5 means Extended partition, which is explained later on. 
  303. Next, there is the ending location (sector) of the partition, and later on,
  304. the relative sector value. This is a number that shows the position of the
  305. partition relative to the present sector. So, for primary partitions, it's
  306. the starting sector of the partition (Primary partitions are the partitions
  307. that are described in the root of the partition structure. As we will see
  308. later on, there are partition descriptors in other places on the disk as 
  309. well, which are called logical drives). The last item of the descriptor,
  310. is the partition length (in sectors). 
  311.  
  312. In the root sector, there is space for 4 descriptors. Right after them, there
  313. is a word value of 0xAA55, which marks the sector as system sector. This
  314. value exists on every sector of the partition structure (including boot 
  315. sectors) and if it doesn't exist, then the structure may probably be damaged.
  316.  
  317. Now, concerning extended partitions, they are described as any other partition
  318. in the root sector, but their treatment is different. These partitions are
  319. specifically treated by the Operating Systems. They point to a sector which
  320. contains partition descriptors for other partitions and extended partitions,
  321. and so on. This is how we can have more than 4 partitions on a disk. Let's
  322. see a small graphic example:
  323.  
  324. MBR     1st Ext         2nd Ext         3rd Ext
  325.        -----------------------------------------------------
  326. 1:p    | 1:l           | 1:l           | 1:l               |
  327. 2:p    | 2:e-----------| 2:e-----------| 2:-               |
  328. 3:e----| 3:-           | 3:-           | 3:-               |
  329. 4:p    | 4:-           | 4:-           | 4:-               |
  330.        -----------------------------------------------------
  331. In this example, we see a map of a partition structure. MBR stands for
  332. Master Boot Record (root sector) and 1st, 2nd and 3rd Ext stand for 
  333. 1st, 2nd and 3rd Extended partition nodes. 'p' stands for primary partition,
  334. 'e' stands for extended partition and 'l' stands for logical drive. 
  335. The 'e' partition in the MBR, is called main or root or primary extended
  336. partition. This is because the whole extended partition structure is depending
  337. on that partition. Now, the starting location of the primary extended 
  338. partition points to the 1st extended partition. The space that the primary
  339. extended partition allocates, is reserved for logical drives. The 1st 
  340. extended partition (and the rest as well) contain information about their
  341. respective logical drives, in a way identical to the MBR (described above),
  342. but without the boot code part. Every extended partition has 4 descriptors
  343. as well, which may contain logical drives, or extended partitions as well.
  344. So, the partition structure is a linked list structure, which can be
  345. as long as we like. (Every extended partition description sector has the
  346. 0xAA55 mark at its end, to identify it as a system sector).
  347.  
  348. There are of course some specifications for partitions. Partitions must 
  349. start at the beginning of a cylinder, and end at a cylinder's end. This is
  350. that starting location must always be Cyl: XXXX  Head: (0 or 1)  Sector 1 and 
  351. the ending location must be Cyl: YYYY  Head: k-1  Sector l, where k is the
  352. number of heads of the physical disk, and l the number of sectors per track
  353. of the physical disk. Also, if you delete one of the middle logical drives, 
  354. (p.e. the 2nd Ext.) then the previous extended partition will be connected
  355. directly to the next, replacing the link. 
  356.  
  357. If you want to see the whole thing yourself, you can make your primary DOS
  358. partition smaller, and create some new logical drives just to play with
  359. them. You can get much help from a commercial Disk Editor, and you can of
  360. course play with Partition Resizer. 
  361.  
  362.  
  363.    3.2 The DOS partition structure
  364.  
  365. The MBR executable code will load the boot partition's boot record. This
  366. is the second step of the booting procedure. And this is where the whole 
  367. thing differs from OS to OS. We will only look at DOS's proceedings for now,
  368. since the rest OS's are less documented and more complicated (although on the
  369. next version of Partition Resizer I'll manage to resize OS/2 partitions, and
  370. if I get lucky enough, why not NTFS...). 
  371.  
  372. The DOS partition is rather simple: The first sector is the boot sector,
  373. right after there are two copies of the FAT (File Allocation Table), right
  374. then we have 32 sectors for the root directory, and finally we have clusters
  375. 0 and 1 (unused) and later on the rest of the clusters. 
  376.  
  377. The Boot record, is an executable code block, which is loaded by the MBR,
  378. and it makes some preparation in order to load the IO.SYS file, which is
  379. the DOS kernel (if we can call it a kernel... ;-)). This is useless to us,
  380. since only the processor can understand machine code, but the boot sector
  381. also contains useful information. This information begins at offset 3 of 
  382. the sector and contains the following:
  383.  
  384. Offset            Description
  385. 0x03-0x0A         OEM ID: This is a small string written by the formatter.
  386. 0x0B-0x0C         Bytes per sector: This is always 512 (it depends on the
  387.                   physical disks characteristics). If you have a disk with
  388.                   a different value, please don't hesitate to inform me.
  389.                   Partition Resizer WON'T WORK FOR DISKS WITH SECTOR SIZE 
  390.                   OTHER THAN 512!
  391. 0x0D              Sectors per Cluster: The cluster is the basic block of
  392.                   information on a FAT drive. A FAT drive cannot have more 
  393.                   than 65527 clusters. This size can limit the maximum size
  394.                   a partition can reach after resizing.
  395. 0x0E-0x0F         Reserved sectors at beginning: This is normally 1, the
  396.                   boot sector. After these sectors, begins the FAT area.
  397. 0x10              FAT copies: How many FAT copies are there. Normally there
  398.                   are two copies of FAT.
  399. 0x11-0x12         Root directory entries: This is normally 512. This shows
  400.                   the maximum number of files and directories that root 
  401.                   directory can hold. This is because the root directory has
  402.                   a constant length (512 entries * 32 bytes/entry / 
  403.                   512 bytes/sector = 32 sectors)
  404. 0x13-0x14         Total sectors on disk (small): If we have less than 65536
  405.                   sectors in the partition, this value contains the number. 
  406.                   If it's more, then the number is stored in bytes 0x20-0x23.
  407.                   This is an entry that was left from the old DOS versions,
  408.                   when partitions could have up to 65536 sectors.
  409. 0x15              Media descriptor byte: This byte is always F8 for hard
  410.                   disks.
  411. 0x16-0x17         Sectors per FAT: This shows how many sectors does each FAT
  412.                   take up. This depends on how many clusters the partition 
  413.                   has, and what is the FAT type (12bit/16bit). This can be
  414.                   from 1 to 255 sectors.
  415. 0x18-0x19         Sectors per track: Same as the physical disk's sectors per
  416.                   track value.
  417. 0x1A-0x1B         Sides: Same as the physical disk's head number.
  418. 0x1C-0x1F         Special hidden sectors: This is how many sectors exist
  419.                   between the partition's description sector and the boot
  420.                   sector. Usually one track.
  421. 0x20-0x23         Big total number of sectors: If we have more than 65536 
  422.                   sectors in the partition, their number is written here.
  423. 0x24-0x25         Physical drive number: This is the physical drive number
  424.                   (c:0x80, d:0x81 etc.).
  425. 0x26              Extended boot record signature: This marks an extended 
  426.                   boot record. If it is 29, the disk was formatted by DOS
  427.                   4.0 or later.
  428. 0x27-0x2A         Volume serial number: This is the partition's serial number.
  429. 0x2B-0x35         Volume label: This is the partition's label string.
  430. 0x36-0x3D         FS ID: This is a string that identifies a partition as
  431.                   12bit FAT or 16bit FAT. 
  432.  
  433. This is a detailed description of the boot record information. This will
  434. help you to understand more about the FAT file system. 
  435.  
  436. The boot sector is the first sector of a DOS partition. The number of
  437. reserved sectors (which is normally 1) shows how many sectors we have before
  438. the FAT area. So in most cases, the first FAT sector is sector 2 of the
  439. partition (from now on, every sector number will be taken relatively from
  440. the beginning of the partition). The first FAT, who's length is given 
  441. in the boot sector, contains entries that mark the partition's space 
  442. allocation. Every file has a small descriptor of 32 bytes, which resides in
  443. its directory area (not in FAT). The directory area is itself a file, which
  444. is described in its parent directory, and so on until we reach root directory,
  445. which is a constant area in the partition (we'll see that later on). A word
  446. value in the file descriptor, tells DOS which is the file's first cluster.
  447. FAT consists of word values (or 12bit values if it is a 12bit FAT system),
  448. which begin from the first sector, and continue until the last one. Every
  449. value represents a cluster, which one is depending on the value's offset from
  450. the FAT's beginning. So, the 3rd word of the FAT stands for the 3rd cluster
  451. of the partition, and so on. So when DOS knows a file's first cluster, it's
  452. looking it up to find the value that is stored in the FAT's respective 
  453. position. That value points to the next cluster of the file, and so on, until
  454. an EOF marking of 0xFFFF is found (0xFFF for 12bit FAT). Empty clusters are
  455. marked with 0 and bad clusters with 0xFFF7. This is how FAT works. Now, the
  456. first two positions of the FAT are reserved, and they have an identification
  457. code which is 0xFFFFFFF8 (0xFFFFF8 for 12bit FAT). 
  458.  
  459. The rest FATs (2nd, 3rd etc.) are identical to the first one. They are
  460. exact copies of the first FAT, and they begin right after the end of the
  461. first FAT. Right after the last FAT, resides the root directory. This is
  462. normally 32 sectors long, and contains 32 byte entries which describe the
  463. root directory's files and directories. Right after the root directory, 
  464. begins the first cluster (cluster 0) which is unused, and so is for cluster 1.
  465. Right after these two clusters, begins the user's space, where the files are
  466. stored.
  467.  
  468. This is the whole story about DOS's file system. This file system was designed
  469. to be fast (it's very easy to find the unallocated space) but it has certain
  470. disadvantages: One is the very large amount of unused space, which is caused
  471. by the use of clusters. For example, if you have a 340MB disk, you have to
  472. use 8192 bytes cluster size (16 sectors). This means that, if you write
  473. a file that is 0 or several bytes long, you will consume space of 8K. This 
  474. could be resolved if we could use more than 65536 clusters in a DOS partition,
  475. which could mean a 20bit fat or more, in order to have clusters of 1 sector.
  476. Since this is not possible, there is another solution: Why should I have
  477. one partition with 8K cluster size, and not 2 partitions with 4K cluster size?
  478. The loss is lowered dramatically, and it would save many megs. This is not 
  479. though always possible, since changing cluster size without loosing the 
  480. existing data is extremely complicated. But who knows, wait till you see the
  481. next version of Partition Resizer...
  482.  
  483.  
  484.    3.3 Is it all that easy?
  485.  
  486. Well, actually it isn't. DOS partitions were designed to remain unchanged. 
  487. So, I faced lots of problems while trying to successfully resize them. The
  488. worst was the FAT12 to FAT16 and vice versa conversion. Why is that needed?
  489. Because those #$%#$@#^!@ who designed the FAT file system, thought it would
  490. be smart to determine the FAT type from the partition's clusters number...
  491. runtime! This means that when you boot your machine, DOS calculates the
  492. number of clusters in a partition, and if it is less than 4088, it's assuming
  493. the FAT to be 12bit, or if it's greater or equal that 4088 it takes it to be
  494. 16bit! Well, I couldn't find a good reason to this technique, but it caused
  495. much trouble, since if I grow a partition over 4088 clusters, or shrink it
  496. to less than 4088, I have to change the FAT from 12 to 16 or vice versa.
  497.  
  498. Another thing that troubled me was the fact that PC Tools DiskFix found
  499. errors in the partition structure while everything seemed to be OK. Later
  500. on, I discovered that PC Tools give a false alarm, if there is empty space
  501. in the extended partition before the first logical drive. This means that,
  502. if you have two logical drives in the extended partition, and you delete the
  503. first one, then PC Tools will warn you without a reason. This is not because
  504. of my program, since the same thing happens with FDISK too. 
  505.  
  506. Still more problems appeared, when I fixed all the above, since PC Tools
  507. consider the cluster limit to be 4080 clusters, and not 4088. So, while
  508. DOS and CHKDSK found the partition to be OK with 4084 clusters and 12bit
  509. FAT, PC Tools DiskFix considered it as 16bit, and it appeared to be messed
  510. up. So, I avoid to make a partition to have clusters number between 4080
  511. and 4088, just to avoid similar problems with other programs.
  512.  
  513. So, normally the partition should be resized correctly. But in case your
  514. diagnostics program finds FAT errors or anything, don't jump to conclusions.
  515. Try the good old CHKDSK. And if you still doubt your partition's integrity,
  516. try a third diagnostics program to get rid of all your doubts.
  517.  
  518.  
  519. 4- Partitioning Techniques
  520.  
  521.    4.1 Deciding what you want
  522.  
  523. Well, OK, you've got the program. But now what happens? Where will you 
  524. create the proper space for a new partition? And which partition is the one
  525. you want to shrink or grow? How should you place the partitions in the 
  526. empty space to order them as you like? How will you grow a partition which
  527. refuses to grow more? 
  528.  
  529. First of all, you have to decide what you want. Take a look at the partition
  530. list that FDISK or Partition Resizer provide you. Decide which partitions)
  531. you need to resize. You may recognise them by their size, or serial numbers.
  532. Then you'll have to think what the new sizes will be. Don't forget that
  533. resizing a logical drive doesn't make space for primary partitions, but only
  534. for logical drives. You will have to move the partitions inside the extended
  535. partition, and then resize the extended partition itself in order to make
  536. space for a new primary partition. The same is for logical drives. Think
  537. of the extended partition like a balloon in a box. You cannot get space in
  538. the box if you don't deflate the balloon, and you cannot inflate the balloon
  539. if you don't empty some space in the box. Remember that what's inside the
  540. extended partition cannot get out of it, and what's outside cannot get inside 
  541. either.
  542.  
  543. Now, here are some useful techniques to use in certain situations. Just take
  544. a look to see if they meet your needs.
  545.  
  546.    
  547.    4.2 Collecting many small partitions into a larger one
  548.  
  549. Sometimes, you get your disk divided into three or four partitions, which
  550. is not a useful thing. Until now, the only solution was to backup all
  551. your data, delete the whole partition structure, and then create a large 
  552. partition to put your data inside. Partition Resizer can resolve the 
  553. problem without any backing up. It's much faster and easier. Just do the 
  554. following:
  555.  
  556. a. Decide which partition will be the one to remain. Normally, you should
  557. choose a primary partition. The problem is if it can grow enough. Decide 
  558. what is the size the partition will finally grow to, and check if your
  559. primary partition can grow to that size. If it can't, go to step b, otherwise 
  560. read step c.
  561.  
  562. b. If you want to create a partition that can grow enough for your needs,
  563. you will have to empty your primary partition. To do this, you have to 
  564. shrink it to its minimum, while growing a logical drive. This can be done by
  565. shrinking the primary partition, expanding downwards the extended partition,
  566. moving the first logical drive to the beginning of the extended partition,
  567. and growing it to the max. Then, exit the program, move as much files as you
  568. can from the primary partition to the grown logical drive, defrag the 
  569. primary partition, and repeat step b until the primary partition is empty.
  570. When you empty it, use the program to change its cluster size that matches 
  571. your needs. You can provide the program with the desired size, which is the
  572. size you want the partition to have when you finish the whole process. 
  573. Partition Resizer will then suggest you a cluster size to apply to the
  574. partition, which is the optimum size for the given desired partition size. 
  575. If this was your boot partition, you will have to make it a system partition
  576. again, so run SYS to do that.
  577.  
  578. c. Now that your primary partition is able to grow enough, start moving 
  579. data into it. Try to get data from small partitions, so that you can 
  580. finish with them early and get rid of them. If you filled up the primary
  581. partition and there's still data in the partition which you are emptying,
  582. move data from the emptying partition to other partitions, in order to 
  583. empty it faster. When the partition is empty, you can delete it with FDISK.
  584. If you cannot empty it, then defrag it, shrink it to its minimum, and move
  585. it to the end of the empty space created, grow the previous partition to
  586. reclaim the empty space created, exit the program, and move the rest of the
  587. data remaining into the grown partition. Repeat this until you empty the 
  588. partition, and then delete it with FDISK.
  589.  
  590. d. One of the small partitions is now deleted. You can now move all the
  591. other logical drives to the end of the empty space, and resize the extended
  592. partition in order to make more space to grow the primary partition. Then
  593. choose another partition and repeat step c until you empty and delete all the
  594. logical drives. With the last one, you can delete the extended partition
  595. too. And presto! You can now grow the primary partition to fill all the
  596. empty space in the disk.
  597.  
  598.  
  599.    4.3 Splitting a partition in two
  600.  
  601. This technique is much alike the previous one. Suppose you have one primary
  602. partition, and you want to split it in two partitions. This is faster and
  603. easier than the previous procedure, just do the following:
  604.  
  605. a. Defrag the primary partition, and then shrink it to the minimum. This way,
  606. you will create empty space for the new partition.
  607.  
  608. b. Using FDISK create an extended partition, and then a logical drive in it.
  609. Format the logical drive, and run Partition Resizer. You will now have to
  610. decide the final size of the new partition, in order to change its cluster
  611. size while it is still empty. When you decide the final size, choose the
  612. third option of Partition Resizer's main menu, and give as desired size the
  613. size you decided. The program will suggest you a cluster size that is optimum
  614. for the partition, and you should apply that size.
  615.  
  616. c. When you finish creating and modifying the new partition, exit the program,
  617. and move the data you want in the new partition. Then, shrink the primary
  618. partition again (defraging is necessary here), extend the extended partition's
  619. starting position towards the beginning of the disk, and then move the logical
  620. drive to the beginning of the extended partition. Grow the logical drive
  621. to the maximum, and repeat this step, until you reach the desired size.
  622.  
  623.    
  624.    4.4 Playing with partitions' sizes and positions
  625.  
  626. And now, some general advice about partition resizing:
  627.  
  628. a. When shrinking a partition, always defrag it first. This will leave 
  629. space at the end of the partition, which will be freed by the program. The
  630. less space you have at the end of the partition, the less the shrinking will
  631. be. When defraging take special care for the unmovable files: They must be
  632. moved too, so change their attributes before defraging the disk. System
  633. files are a special case of unmovable files. You must be extra careful with
  634. these. Check the TROUBLE.DOC to see more info about the system files.
  635.  
  636. b. Although Partition Resizer can move primary partitions, you will rarely
  637. need to do this. You should always leave your DOS primary partitions in their
  638. original place, unless you absolutely need to move them. This will not harm
  639. the partition, but it might leave unused space before the primary partition
  640. which will never be used by DOS's FDISK. Warning: if you move a primary DOS
  641. partition, you won't be able to boot from that partition!
  642.  
  643. c. If you want to install a new operating system, you may have to delete
  644. much of your data in the DOS partition, since you cannot move that data in
  645. the new partition. So, you will only have to shrink your DOS partition once.
  646.  
  647. d. Always follow the safety rules described in README.1ST. Playing with your
  648. data can be REALLY dangerous sometimes, so be very careful.
  649.  
  650.  
  651. 5- Credits and addresses
  652.  
  653. First of all, I would like to thank everyone that believed in my project
  654. (that is ABSOLUTELY NOBODY!). I would like to thank Laertis (Billy Anagnostou)
  655. for sharing his work with me, since he was the first to disassemble MBR
  656. code and Boot record code, and gave me the basic knowledge on partitioning.
  657. I would also like to thank Raymond Skevakis for testing my program on his
  658. disk before I even finish it. Special thanks go to Dr. Hans Michael Kvasnicka
  659. (akl02@rs1.rrz.uni-koeln.de) for additional SCSI testing and for his advice 
  660. on SCSI support. Special thanks also go to Jorge (George Anastassakis) for 
  661. beta testing version 1.1.0 on his ruined system. I also thank you, for 
  662. spending the time to read this document and for using my program. I hope that 
  663. the technical info included in here will seriously help many of you to create 
  664. your own programs. If you find this program useful, you can always send me a 
  665. postcard to the following address:
  666.  
  667.         John Lagonikas
  668.         17 Lycourgou Str.
  669.         16675 Glyfada
  670.         ATHENS, GREECE
  671.  
  672. or send me a netmail to any of these addresses:
  673.  
  674.         FidoNet: 2:410/124.6
  675.         SigNet: 27:1330/100.6
  676.         GrUnNet: 30:3001/108.1
  677.  
  678. or send me a message in the Internet addresses:
  679.  
  680.         zeleps@prometheus.hol.forthnet.gr      <-- try this one first!
  681.         zeleps@hellas.hol.forthnet.gr
  682.  
  683. Of course, if you have any question you'd like to ask me about the program or
  684. the technical info, don't hesitate to send me a message. I'll be glad to help
  685. you (if I can of course). Anyway, if you used the program and you liked it,
  686. please send me a message with your opinion and your suggestions for the 
  687. program.
  688.  
  689. Request: If anyone has any info on any other file system than FAT, please 
  690. contact me. Thank you.
  691.  
  692.                                ------||------
  693.